package logique.solution;

public class Affectation<Type> {

	private Type value;
	private Variable variable;

	
	public Affectation(Type value, Variable variable) {
		super();
		this.value = value;
		this.variable = variable;
	}
	public Affectation<?> getCopy(Variable v) {
		return new Affectation<Type>(getValue(), v);
	}
	public Affectation<?> getCopy() {
		return getCopy(variable);
	}
	public Type getValue() {
		return value;
	}
	public void setValue(Type t) {
		value = t;
	}
	
	

	public Variable getVariable() {
		return variable;
	}
	
	public boolean equals (String nomVecteur, int indice) {
		return variable.equals(nomVecteur, indice);
	}
	
	public void affecter() {
		
	}
	
	public String toString () {
		return "[ " + (variable==null?"null":variable.toString()) + " <- " + (value==null?"null":value.getClass().getName()) + " " + value + " ]"; 
	}
	public void afficher () {
		System.out.print("[ ");
		variable.afficher();
		System.out.print(" <- " + value.getClass().getName() + " " + value + " ]"); 
	}

}